package com.ghsc.ghxc.jsb.view

import androidx.appcompat.app.AppCompatActivity
import com.cn.appcore.utils.TimeUtils
import com.ghsc.ghxc.jsb.R
import com.ghsc.ghxc.jsb.ui.bean.VersionDataBean
import com.ghsc.ghxc.jsb.ui.main.fragment.VersionFragment
import com.lxj.xpopup.core.CenterPopupView

/**
 * 项目：GuoHuaMall
 * 包名：com.ghsc.ghxc.ui.login.view
 * 类名：VersionPopView
 * 创建时间：2023/8/20 15:15
 * 创建人 @author： xiaolin
 * 描述 ：Todo... 版本
 */
class VersionPopView (context: AppCompatActivity,sysBean : VersionDataBean) : CenterPopupView(context) {
    private val mContext = context
    private val mSysBean = sysBean
    override fun getImplLayoutId() = R.layout.popup_version



    private var onCloseDismiss:(() -> Unit)? = null

    override fun onCreate() {
        super.onCreate()


        val beginTransaction = mContext.supportFragmentManager.beginTransaction()
        val fragment = VersionFragment.newInstance(mSysBean)
        beginTransaction.add(R.id.flContainer,fragment)
        beginTransaction.commit()
        fragment.setOnDismissListener {
            onCloseDismiss?.invoke()
            this@VersionPopView.dismiss()

        }
    }
    fun setOnCloseDismiss(listener: (() -> Unit)){
        this.onCloseDismiss = listener
    }

}